package designPattern.structure7.Adapter.chapter8_adapter.test8_6;

import java.util.Iterator;
import java.util.LinkedList;

public class NewBookNameList {
    LinkedList<String> bookList;
    Iterator iterator;

    NewBookNameList(Iterator iterator) {
        bookList = new LinkedList<String>();
        this.iterator = iterator;
    }

    public void setBookName() {
        while (iterator.hasNext()) {
            String name = (String) iterator.next();
            bookList.add(name);
        }
    }

    public void getBookName() {
        Iterator<String> iter = bookList.iterator();
        while (iter.hasNext()) {
            String name = iter.next();
            System.out.println(name);
        }

    }
}